﻿namespace Ngs.MetaData
{
    using System;

    public static class MetaDataExtensions
    {
        static MetaDataExtensions()
        {
        }

        internal static MetaVisibility ReflectionType(Type type)
        {
            return type.IsPublic ? MetaVisibility.Public : MetaVisibility.Private;
        }

        internal static int ToInt32(this MetaVisibility visibility)
        {
            return (int)visibility;
        }

        internal static MetaVisibility ParseInt(this MetaVisibility visibility, int value)
        {
            switch (value)
            {
                case 0:
                    return MetaVisibility.Public;
                case 1:
                    return MetaVisibility.Private;
                case 2:
                    return MetaVisibility.Internal;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
    }
}
